<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('企业内应用列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="ding:innerApp:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
               <!-- <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="ding:innerApp:update">
                    <i class="fa fa-edit"></i> 修改
                </a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ding:innerApp:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('ding:innerApp:edit')}]];
        var removeFlag = [[${@permission.hasPermi('ding:innerApp:remove')}]];
        var detailFlag = [[${@permission.hasPermi('ding:innerApp:detail')}]];
        var sysInnerAppStatus= [[${@dict.getType('sys_inner_app_status')}]];
        var sysInnerAppType= [[${@dict.getType('sys_inner_app_type')}]];

        var prefix = "/ding/innerApp";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                detailUrl: prefix + "/detail/{id}",
                modalName: "企业内应用",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'agentId',
                    title: 'agentId',
                    visible: true
                },
               /* {
                    field: 'appId',
                    title: '回调名称'
                },*/
                {
                    field: 'name',
                    title: '应用名称'
                }, /*{
                        field: 'desc',
                        title: '回调url'
                    },*/
                 /*   {
                        field: 'homepageLink',
                        title: '回调url'
                    },
                    {
                        field: 'ompLink',
                        title: '回调url'
                    },
                    {
                        field: 'pcHomepageLink',
                        title: '回调url'
                    },*/
                    {
                        field: 'developType',
                        title: '应用类型',
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(sysInnerAppType, value);
                        }
                    },
                    {
                    field: 'appStatus',
                    title: '应用状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(sysInnerAppStatus, value);
                    }},

                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
/*                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');

                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');*/
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function registerCallBack(id) {
            $.ajax({
                type: "GET",
                url: "/system/back/register?id="+id,
                cache: false,
                contentType: false,
                processData: false,
                dataType: 'json',
                success: function(result) {
                    if (result.code == web_status.SUCCESS) {
                        $.modal.alertSuccess(result.msg);
                    } else {
                        $.modal.alertError(result.msg);
                    }
                },
                error: function(error) {
                    $.modal.alertWarning("注册失败。");
                }
            });
        }
    </script>
</body>
</html>